
#include "rbfUtils.h"

Number randomGenerator() {
   
   // generates points in the intervale [-1 1]
   return (2*rand())/(Number)RAND_MAX;
}

Point3 pointRandomGenerator() {
   
   // generates points in the cube [-1 1]^3
   Point3 p;
   p[0] = (2*rand())/(Number)RAND_MAX;
   p[1] = (2*rand())/(Number)RAND_MAX;
   p[2] = (2*rand())/(Number)RAND_MAX;
   return p;
}

///
void gridGenerator(int nvGridX, int nvGridY, int nvGridZ, vector<Point3> &points) {
   
   Number xmin =-1.0, ymin =-1.0, zmin =-1.0;
   Number xmax = 1.0, ymax = 1.0, zmax = 1.0;
   Number deltaX = (xmax - xmin)/(Number)(nvGridX-1);
   Number deltaY = (xmax - xmin)/(Number)(nvGridY-1);
   Number deltaZ = (xmax - xmin)/(Number)(nvGridZ-1);
   
   Point3 p;
   for (int iz=0; iz<nvGridZ; ++iz) {
      p[2] = zmin + deltaZ*iz;
      for (int iy=0; iy<nvGridY; ++iy) {
         p[1] = ymin + deltaY*iy;
         for (int ix=0; ix<nvGridX; ++ix) {
            p[0] = xmin + deltaX*ix;
            points.push_back(p);
         }
      }
   }
   
   //cout<<"the points"<<endl;
   //copy(points.begin(), points.end(), ostream_iterator<Point3>(cout, " "));
}
